﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using A2DFramework.InstanceService;

namespace A2DFramework.Repository
{
    public interface IRepository
    {
        IEnumerable<T> Get<T>(
            Expression<Func<T, bool>> filter = null,
            Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
            string includeProperties = "")
            where T : class;

        T GetByID<T>(object id)
            where T : class;
        void Insert<T>(T entity)
            where T : class;
        void Delete<T>(object id)
            where T : class;
        void Delete<T>(T entityToDelete)
            where T : class;
        void Update<T>(T entityToUpdate)
            where T : class;

        IEnumerable<T> GetWithRawSql<T>(string query, params object[] parameters)
            where T : class;

        void Save();
    }
}
